﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public static class IListHelper
    {
        public static IList<T> replaceListIndex<T>(IList<T> iList, int index1, int index2)
        {
            IList<T> _IList = iList;
            if (!iList.SafeCheck())
            {
                return _IList;
            }
            
            if (_IList.Count < index1 || _IList.Count < index2)
            {
                return _IList;
            }

            T t = _IList[index1];
            _IList[index1] = _IList[index2];
            _IList[index2] = t;

            return _IList;
        }
    }
}
